<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
	String path = request.getContextPath();
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>指派资源</title>
<script src="<%=path %>/js/formValidator-4.1.1.js" type="text/javascript" charset="UTF-8"></script>
<script src="<%=path %>/js/formValidatorRegex.js" type="text/javascript" charset="UTF-8"></script>
<script src="<%=path %>/js/DateTimeMask.js" type="text/javascript" charset="UTF-8"></script>
<script type="text/javascript">
	$(function(){
		//配置功能组
		$('#configRg').click(function() {
			if (confirm("确认要重新配置该资源组相关资源?")) {
				$('#rForm').submit();
			}
		});
	});
</script>
</head>
<body>
	<form id="rForm" action="<%=path%>/resourceGroup/configResGroup.htm" method="post">
		<input type="hidden" name="resourceGroup.RGId" value="${resourceGroup.RGId }"></input>
		<input type="hidden" id="checkItems" name="checkItems"></input>
		<table style="width: 100%; border-collapse: collapse; border-color: #D4D4D4;">
			<tr>
				<td width="20%"></td>
				<td>
					<table style="width: 100%;border: outset 1pt;horizontal-align: right;">
						<tr style="background-color: #DEF2FF">
					      <td align="center" colspan="2">资源组:&nbsp;${resourceGroup.resourceGroupName }&nbsp;&nbsp;&nbsp;&nbsp;已有资源</td>
					    </tr>
					    	<c:choose>
								<c:when test="${inGroupRes == null || fn:length(inGroupRes) <= 0}">
									<tr class="tr_nomal"><td colspan="2" style="text-align: center;">该资源组未指派资源</td></tr>
								</c:when>
								<c:otherwise>
									<c:forEach items="${inGroupRes }" var="res" varStatus="status">
										<c:if test="${status.index%2 == 0}"><tr class="tr_nomal"></c:if>
											<td width="50%"><input type="checkbox" checked="checked" name="checkItems" value="${res['R_ID'] }"></input>&nbsp;&nbsp;${res['RESOURCE_NAME'] }</td>
										<c:if test="${status.index+1 == fn:length(inGroupRes) && fn:length(inGroupRes)%2 != 0 }">
											<td width="50%"></td>
										</c:if>
										<c:if test="${status.index%2 != 0}"></tr></c:if>
									</c:forEach>
								</c:otherwise>
						</c:choose>
					</table>
				</td>
				<td width="20%"></td>
			</tr>
			<tr height="10px">
				<td colspan="3"></td>
			</tr>
			<tr>
				<td width="20%"></td>
				<td>
					<table style="width: 100%;border: outset 1pt;horizontal-align: right;">
						<tr style="background-color: #DEF2FF">
					      <td align="center" colspan="2">未分组资源</td>
					    </tr>
					    	<c:choose>
							<c:when test="${noGroupRes == null || fn:length(noGroupRes) <= 0}">
								<tr class="tr_nomal"><td colspan="2" style="text-align: center;" >无未分组资源</td></tr>
							</c:when>
							<c:otherwise>
								<c:forEach items="${noGroupRes }" var="res" varStatus="status">
									<c:if test="${status.index%2 == 0}"><tr class="tr_nomal"></c:if>
										<td width="50%"><input type="checkbox" name="checkItems" value="${res['R_ID'] }"></input>&nbsp;&nbsp;${res['RESOURCE_NAME'] }</td>
									<c:if test="${status.index+1 == fn:length(noGroupRes) && fn:length(noGroupRes)%2 != 0 }">
										<td width="50%"></td>
									</c:if>
									<c:if test="${status.index%2 != 0}"></tr></c:if>
								</c:forEach>
							</c:otherwise>
						</c:choose>
						<tr>
							<td></td>
							<td style="padding-left: 100px;"><input id="configRg" type="button" value="提交"></input></td>
						</tr>
					</table>
				</td>
				<td width="20%"></td>
			</tr>
		</table>
	</form>
</body>
</html>